﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Infrastructure.Common.JWT
{
    /// <summary>
    /// 存放Token 跟过期时间的模型类
    /// </summary>
    public class TnToken
    {
        /// <summary>
        /// token字符串
        /// </summary>
        public string TokenStr { get; set; }
        /// <summary>
        /// token过期时间
        /// </summary>
        public DateTime Expires { get; set; }
    }
    public interface ITokenHelper
    {
        /// <summary>
        /// 根据一个对象通过反射提供负载，生成token
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="user"></param>
        /// <returns></returns>
        public TnToken CreateToken<T>(T entity) where T : class;
        /// <summary>
        /// 根据键值对提供负载，生成token
        /// </summary>
        /// <param name="keyValuePairs"></param>
        /// <returns></returns>
        public TnToken CreateToken(Dictionary<string, string> keyValuePairs);
    }
}
